package com.wxc.api.admin.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 菜单表
 * </p>
 *
 * @author baomidou
 * @since 2022-04-28
 */
@TableName("sys_menu")
@Data
public class SysMenu implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 菜单名称
     */
    @NotBlank(message = "菜单名称不能为空")
    private String name;

    /**
     * 权限标识
     */
    private String permission;


    private String path;

    private String component;

    private String url;

    private String redirect;

    /**
     * 上级id
     */
    private Integer pid;

    /**
     * 是否显示
     */
    private Boolean isShow;

    @TableField(exist = false)
    private List<SysMenu> treeList = new ArrayList<>();

    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @ApiModelProperty("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPermission() {
        return permission;
    }

    public void setPermission(String permission) {
        this.permission = permission;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    public void setIsShow(Boolean isShow) {
        this.isShow = isShow;
    }
    public Boolean getAccountNotLocked() {
        return isShow;
    }

    @Override
    public String toString() {
        return "SysMenu{" +
                "id=" + id +
                ", name=" + name +
                ", permission=" + permission +
                ", path=" + path +
                ", pid=" + pid +
                "}";
    }
}
